package com.pl.myshop.provider.service.fallback;

import com.pl.myshop.provider.domain.UmsAdmin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * <p>
 *
 * @Description: TODO
 * </p>
 * @ClassName UmsAdminServiceFallback
 * @Author pl
 * @Date 2020/4/1
 * @Version V1.0.0
 */
public class UmsServiceFallback {

    private static final Logger logger = LoggerFactory.getLogger(UmsServiceFallback.class);
    /**
     * @MethodName: getUserByUserName
     * @Description: getUserByUserName的熔断方法，必须是static
     * @Param: [userName, ex]
     * @Return: com.pl.myshop.provider.domain.UmsAdmin
     * @Author: pl
     * @Date: 12:41
    **/
    public static UmsAdmin getByUsernameFallback(String userName, Throwable ex) {
        logger.warn("Invoke getByUsernameFallback: " + ex.getClass().getTypeName());
        ex.printStackTrace();
        UmsAdmin umsAdmin = new UmsAdmin();
        umsAdmin.setUsername("熔断");
        return umsAdmin;
    }
}